For information about scripting the <FORM> element, see the Scripting the <FORM> element topic.

The Form element is used to delimit a data input form. There can be several forms in a single document, but the Form element can not be nested. (I.e. a form can't contain another form)

<FORM ACTION="_URL_" METHOD="GET|POST" ENCTYPE="MIME type">
. . .
</FORM>

The ACTION attribute is a URL specifying the location to which the contents of the form data fields are submitted to elicit a response. As mentioned before, this could be simply a direction to an e-mail address, but generally, would be used to point towards some kind of server based CGI script/application that handles the forwarding of form data. If the ACTION attribute is missing, the URL of the document itself is assumed. The way data is submitted varies with the access protocol of the URL to which the form data is sent and with the values of the METHOD and ENCTYPE attributes.

Generally, the METHOD attribute specifies a method of accessing the URL specified in the ACTION attribute and will be either GET or POST. The GET method is ideal for form submission where the use of the form data does not require external processing. For example, with database searches, there is no lasting effect caused by the query of the form (that is, the query runs its search through the database and reports the results). However, where the form is used to provide information for example, that updates a database, then the POST method should be used, with the ACTION attribute pointing to a CGI script that executes the form data processing.

The ENCTYPE specifies the media type used to encode the form data. The default ENCTYPE is the MIME type 'application/x-www-form-urlencoded'

The <FORM> element can also accept the TARGET attribute (as in <A> elements), to specify what window is used for any form feedback. It can take the following values :

window_name
The name of any window specified by a <FRAME> element, or by using the window.open scripting method. If a window_name is used which does not correlate to a previously defined window, then a new window is created and NAMEd according the the window name used in the TARGET attribute. This new window can then be referenced using it's new name.
_self
Using this reserved keyword value, would cause any form feedback page to be loaded into the window that currently contains the form.
_parent
Using this reserved keyword value, would cause any form feedback page to be loaded into the window that is the parent of the window currently containing the form. i.e. if the form's window is part of a framed document, it would load into the window controlled by the <FRAMESET> element definitions that control the form's current window.
_top
Using the reserved keyword value would cause the form feedback page to be loaded into the topmost window, clearing any currently existing framed windows.
_blank
Using tis reserved keyword value would cause the form feedback page to be loaded into a newly created window. Using this value is the same as using TARGET="window_name" where the window_name used is not a previously defined window. NOTE : Unlike using the window_name using a previously undefined window name, using _blank will not name the new window for future use.

the <FORM> can also take the NAME attribute, which can be used to set the name of the element for scripting purposes.

Layout information can be applied to the <FORM> element through the use of Style Sheets. See that topic for more information.


Form Elements Overview Form Elements Overview <INPUT>